<?php
class home extends Activity {
    /** @var  UserModule */
    protected $user;
    function __construct(){
        $this->user=UserModule::init();
    }

    function indexTask(){
        $result=array();
        View::displayAsHtml($result,"index.php");
    }

    function navTask($current=0){
        $menuMode=MenuModule::init();
        list($result['nav'],$total)=$menuMode->getList(null,array("pid"=>0));
        $result['current']=(int)$current;
        View::displayAsHtml($result,"fragment/nav.php");
    }

    function subNavTask($menu_id=1){
        $menuMode=MenuModule::init();
        // 查询子分类
        list($result['subNav'],$subTotal)=$menuMode->getNotBottomSon($menu_id);
        View::displayAsHtml($result,"fragment/subNav.php");
    }

    function titleNavTask($menu_id=1){
        $menuMode=MenuModule::init();
        // 查询上级分类
        list($result['ancestorNav'],$ancestorTotal)=$menuMode->getAncestor($menu_id);
        View::displayAsHtml($result,"fragment/titleNav.php");
    }

    function loginAndSearchTask(){
        $result['userInfo']=$this->user->getLoginInfo();
        View::displayAsHtml($result,"fragment/loginAndSearch.php");
    }
}